package org.coast.mvc.logging;

import java.util.Date;

public class LogRecord {

    /**
     * log message
     */
    private String message;

    /**
     * log threadId
     */
    private Long threadId;

    /**
     * log threadName
     */
    private String threadName;

    /**
     * log createTime
     */
    private Date createTime;

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Long getThreadId() {
        return threadId;
    }

    public void setThreadId(Long threadId) {
        this.threadId = threadId;
    }

    public String getThreadName() {
        return threadName;
    }

    public void setThreadName(String threadName) {
        this.threadName = threadName;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public LogRecord(String message, Long threadId, String threadName, Date createTime) {
        this.message = message;
        this.threadId = threadId;
        this.threadName = threadName;
        this.createTime = createTime;
    }

    public LogRecord(String message) {
        this.message = message;
        Thread thread = Thread.currentThread();
        this.threadId = thread.getId();
        this.threadName = thread.getName();
        this.createTime = new Date();
    }

    @Override
    public String toString() {
        return "LogRecord{" +
                "message='" + message + '\'' +
                ", threadId='" + threadId + '\'' +
                ", threadName='" + threadName + '\'' +
                ", createTime=" + createTime +
                '}';
    }
}
